<template>
  <div id="app">
    <div class="main">
      <div class="bj"></div>
      <router-view></router-view>
      <div class="box">
        <div class="container">
          <div class="back" @click="cit">X</div>
          <div class="wtbox">
            <div class="wt" style="background: #eaf9f6;">
              <div class="icon_1">
                <img src="../src/assets/img/tiGeWT.png" alt="">
              </div>
              <div class="txt"><span>提个问题</span></div>
            </div>
            <div class="wt" style="background-color: #e9f1fc;">
              <div class="icon_1">
                <img src="../src/assets/img/hui.png" alt="">
              </div>
              <div class="txt"><span>回答问题</span></div>
            </div>
          </div>
          <div class="list">
            <ul>
              <li v-for="(item, index) in arr">
                <div class="icon_2">
                  <img :src=item.img alt="">
                </div>
                <div class="icon_name">
                  <span>{{ item.text }}</span>
                </div>
              </li>
            </ul>
          </div>
          <div class="create_box">
            <div class="lg">
              <span>创作灵感</span>
            </div>
            <div class="genduo">
              <span>查看更多></span>
            </div>
            <div class="title">
              <span>你每天坚持上班的理由是什么？</span>
            </div>
            <div class="data">
              <span>10161回答 · 10349关注</span>
            </div>
            <div class="icon_3">
              <img src="../src/assets/img/xieHui.png" alt="">
            </div>
          </div>
        </div>

      </div>
    </div>
    <div class="bottom">
      <ul class="bottom_box">
        <li><router-link to="/home/list" active-class="active"><van-icon name="wap-home" size="0.9rem" />
            <p>首页</p>
          </router-link></li>
        <li><router-link to="/answer" active-class="active"><van-icon name="font" size="0.9rem" />
            <p>直答</p>
          </router-link></li>
        <li><van-button icon="plus" type="info" style="border-radius: 50%;" @click="cit" /></li>
        <li><router-link to="/information" active-class="active"><van-icon name="bell" size="0.9rem" />
            <p>信息</p>
          </router-link></li>
        <li><router-link to="/my" active-class="active"><van-icon name="user" size="0.9rem" />
            <p>我的</p>
          </router-link></li>
      </ul>
    </div>
  </div>
</template>

<style lang="less">
.bj {
  width: 100%;
  height: 100%;
  top: 0;
  background-color: rgba(0, 0, 0, .3);
  position: fixed;
  display: none;
  z-index: 1000;
}

.box {
  height: 0%;
  width: 100%;
  position: fixed;
  z-index: 1001;
  bottom: 0px;
  border: 0.5px;
  border-radius: 10px;
  background-color: #fff;
  transition: all 1s;
  .container{
    width: 94%;
    margin: 0 auto;
  }
  .wtbox {
    width: 100%;
    display: flex;
    margin-top: 20px;
    justify-content: space-between;
    .wt{
      width: 48%;
      height: 80px;
      border-radius: 12px;
      position: relative;
      .icon_1{
        width: 24%;
        margin-left: 30px;
        margin-top: 24px;
        img{
          width: 100%;
        }
      }
      .txt{
        position: absolute;
        font-size: 14px;
        top: 28px;
        left: 80px;
      }
    }
  }
  .list{
    width: 100%;
    margin-top: 20px;
    ul{
      width: 100%;
      display: flex;
      justify-content: space-between;
      li{
        width: 14%;
        .icon_2{
          width: 100%;
          img{
            width: 100%;
            height: 39px;
          }
        }
        .icon_name{
          font-size: 14px;
          margin-top: 5px;
          margin-left: 2px;
        }
      }
    }
  }
  .create_box{
    width: 100%;
    margin-top: 30px;
    height: 120px;
    border-radius: 15px;
    border: 1px solid #868585;
    position: relative;
    .lg{
      font-size: 16px;
      position: absolute;
      top: 5px;
      left: 10px;
    }
    .genduo{
      font-size: 16px;
      position: absolute;
      top: 5px;
      right: 10px;
      color: #868585;
    }
    .title{
      margin-top: 40px;
      margin-left: 10px;
      font-size: 20px;
    }
    .data{
      margin-top: 20px;
      font-size: 14px;
      margin-left: 10px;
      color: #868585;
    }
    .icon_3{
      width: 20%;
      position: absolute;
      right: 10px;
      bottom: 10px;
      img{
        width: 100%;
        border-radius: 16px;
      }
    }
  }
}

.bottom {
  position: fixed;
  width: 100%;
  left: 0;
  bottom: 0px;
  z-index: 1000;

  .bottom_box {
    display: flex;
    align-items: center;
    justify-content: space-around;
    width: 100%;
    height: 60px;
    bottom: 0px;
    background-color: #fff;

    a {
      flex-basis: 20%;
      font-size: 14px;
      flex-shrink: 0;
      text-align: center;
    }

    .active {
      color: #1772f6;
    }
  }
}
</style>
<script>
export default {
  data() {
    return {
      isOpen: false,
      arr: [
        {
          text: '发想法',
          img: require('@/assets/img/icon1.png'),
        },
        {
          text: '写文章',
          img: require('@/assets/img/icon2.png'),
        },
        {
          text: '发视频',
          img: require('@/assets/img/icon3.png'),
        },
        {
          text: '开直播',
          img: require('@/assets/img/icon4.png'),
        },
      ]
    }
  },
  methods: {
    cit() {
      this.isOpen = !this.isOpen;
      if (this.isOpen) {
        document.querySelector('.box').style.height = '60%'
        document.querySelector('.bj').style.display = 'block'
        document.body.style.backgroundColor = 'rgba(0, 0, 0, .3)'
      } else {
        document.querySelector('.box').style.height = '0%'
        setTimeout(() => {
          document.body.style.backgroundColor = 'rgba(0, 0, 0, .0)'
          document.querySelector('.bj').style.display = 'none'
        }, 700);
      }
    }
  },
  mounted() {
    document.title = '懂乎'
  },
  updated() {
  }
}
</script>
